#define _CRT_SECURE_NO_WARNINGS 1

int majorityElement(int* nums, int numsSize) {
    int cmp = 0;
    int most;
    for (int i = 0; i < numsSize; ++i)
    {
        if (cmp == 0)
        {
            most = nums[i];
        }
        if (nums[i] == most)
            ++cmp;
        else
            --cmp;
    }
    return most;
}